# -*- codeing = utf-8 -*-
# @Time : 2021/2/25 15:02
# @Atuthor: 朱朱
# @File: 090装饰器综合案例.py
# @Software: PyCharm

# 产品经理: 提需求 / 改需求.
# 如果超过22点不让玩儿游戏，如果不告诉时间，默认让玩儿游戏
# 开放封闭原则
def cal_play(fn):
    def inner(x,y,*args,**kwargs):
        al = list(args)
        print(al)
        print(type(kwargs))
        clock = kwargs.get('clock',20)
        if clock <= 22:
            print(args)
            fn(x,y)
        else:
            print('太晚了,赶紧上床死觉吧')

    return inner

@cal_play
def play_game(name,game):

    print(f'{name}正在玩{game}.....')

# play_game('张三','刺激战场')
play_game('李四','和平精英',m='hello',n='good',clock=23)